#ifndef _XX_YY_BMOCK_OUT_RAW_MEM_PTR
#define _XX_YY_BMOCK_OUT_RAW_MEM_PTR
#include "bmock_raw_mem.hpp"
#include "bmock_out_arg_val.hpp"

namespace bmock {
	struct out_raw_mem_ptr : public out_arg_val {
		                  out_raw_mem_ptr(const char *const n,const void *exp,const raw_mem &tar);
						  template<typename T>
						  out_raw_mem_ptr(const char *const n,const T &value_,const raw_mem &tar,typename boost::disable_if<boost::is_pointer<T> >::type* dummy = 0)
							  :out_arg_val(n)
							  ,rm_exp_((void*)&value_)
							  ,rm_target_(tar)
						  {dummy=0;}
						  ~out_raw_mem_ptr();
	protected:
		std::string       get_out_value(const arg_checker &) const;
		bool              update_out_value(const arg_checker &chk,const std::string &v) const;
		void			  update(const std::string &v,const control_tools_ptr&,int index) const;
		bool              null_supplied() const;
		const void *const rm_exp_;
		const raw_mem     rm_target_;
		out_raw_mem_ptr &operator =(const out_raw_mem_ptr) {
			return *this;
		}
	};

	template<typename T>
	inline raw_mem __raw_mem(const T &value_,size_t len=1) {
			return raw_mem(value_,len);
	}

	template<typename T>
	inline typename boost::enable_if<boost::is_pointer<T>,raw_mem>::type 
		__raw_mem(T *ptr_,size_t len=1) {
			return raw_mem(ptr_,len);
	}

}

#define __BMOCK_USE_RAW_OUT(ARG,LEN)\
	new bmock::out_raw_mem_ptr(BOOST_PP_STRINGIZE(ARG),ARG,bmock::__raw_mem(ARG,LEN))

#endif